# -*_ codeing=utf-8 -*-
# @Time: 2024/12/11 9:18
# @Author: foxhuty
# @File: df_notes.py
# @Software: PyCharm
# @Based on python 3.10
import pandas as pd
import asyncio
import time


def time_use(fn):
    def inner(*args, **kwargs):
        print(f'开始运行主函数{fn.__name__}'.center(106, '_'))
        start_time = time.time()
        result = fn(*args, **kwargs)
        end_time = time.time()
        time_used = end_time - start_time
        print(f'主函数{fn.__name__}结束运行'.center(106, '_'))

        print(f'运行主函数{fn.__name__}共计耗时{round(time_used, 2)}秒')
        return result

    return inner


file = r'D:\data_test_files\高2022级零诊成绩测试数据.xlsx'
file_path = r'D:\data_test\高三半期考试成绩年级.xlsx'
# 物理类各科有效分
subjects_good_scores_physics = {'语文': 84, '数学': 64, '英语': 63, '物理': 25, '政治': 61,
                                '地理': 61, '化学': 56, '生物': 57, '总分': 370}
# 历史类各科有效分
subjects_good_scores_history = {'语文': 87, '数学': 45, '英语': 62, '历史': 46, '政治': 62,
                                '地理': 63, '生物': 52, '总分': 370}


@time_use
def open_excel_files(excel_file):
    df_history = pd.read_excel(excel_file, sheet_name='历史类')
    df_physics = pd.read_excel(excel_file, sheet_name='物理类')
    # print(df_history.head())
    # print(df_physics.head())
    return df_physics, df_history


@time_use
async def open_excel_file(excel_file):
    df_genearl = await pd.read_excel(excel_file, sheet_name='总表')
    print(df_genearl.head())
    return df_genearl
def get_excel_file(excel_file):
    df_history = pd.read_excel(excel_file, sheet_name='历史类')
    df_physics = pd.read_excel(excel_file, sheet_name='物理类')
    # print(df_history.head())
    # print(df_physics.head())

if __name__ == '__main__':
    # asyncio.run(open_excel_files(file))
    # open_excel_file(file_path)
    # get_excel_file(file)
    # df_physics, df_history = asyncio.run(open_excel_files(file))
    df_ph,df_his = open_excel_files(file)
    names=df_ph['姓名'].values.tolist()
    print(names)


